Ext.onReady(function() {
	Ext.QuickTips.init();
    
	// Disable browser right click
	Ext.fly(document.body).on('contextmenu', function(e, target) {
		e.preventDefault();
	});
	
	var viewport = new Ext.Viewport({
			layout: 'border'
		,	renderTo: Ext.getBody()	
    ,	items: [{
					height: 50
				,	region: 'north'
				,	border: false
				,	bodyStyle: 'background-color: #4E78B1;'
				,	html:'<div class="tm-title">Taxamatch Interactive Web Service</div><div class="tm-help"><a href="http://code.google.com/p/taxamatch-webservice/wiki/admin" target="_blank">Help Documentation</a></div>'
			},{
					xtype: 'grouptabpanel'
				,	tabWidth: 130
				,	activeGroup: 0
				,	region:'center'
				,	items: [{
						mainItem: 0
					,	items: [{
								style: 'padding: 10px;'
							,	layout: 'fit'
						//	,   activeTab:'newsid'						
						},{
								title: 'Database'
							,	layout: 'fit'
							//,	iconCls:'icon-database'
							,	iconCls: 'x-icon-tickets'
							,	tabTip: 'Use this to register database connections.'
							,	style: 'padding: 10px;'
							,	items: [new Taxamatch.Database()]
							,	listeners:{
									activate:function(){
										this.items.items[0].store.load();
									}
								}
						},{
								title: 'Authorities'
							,	layout: 'fit'
							,	iconCls: 'x-icon-tickets'
							,	tabTip: 'Here you can view the authorities change from active to inactive.'
							,	style: 'padding: 10px;'
							,	items: [new Taxamatch.Authorities()]
							,	listeners:{
									activate:function(){
										this.items.items[0].store.load();
									}
								}
						},{
								title: 'Add Authority'
							,	layout: 'fit'
							,	iconCls:'x-icon-tickets'
							,	tabTip: 'Use this to register a new authority to search against.'
							,	style: 'padding: 10px;'
							,	items: [new Taxamatch.AddAuthoirities()]
							,	listeners:{
									activate: function(){
										Ext.getCmp('db').store.reload();
									}	
								}
						}]
				}]
			}]	
	});
	
	Ext.get('loading').remove();
	Ext.get('loading-mask').fadeOut({remove:true});	

});